import request from '../request.js'

//获取商品详情页面
function productDetail(id){
	return request({
		url:`/lejuClient/product/productDetail/${id}`
	})
}
/** 
  * 添加到购物车
  * @return 
  */
function addCart(data){
	return request({
		url:`/lejuClient/cart/addCart`,
		method:'post',
		data
	})
}
	
/** 
  * 生成订单
  * @return 
  */
function addPreOrder(data){
	return request({
		url:`/lejuClient/order/addPreOrder`,
		method:'post',
		data
	})
}
/** 
  * 根据订单id获取订单明细
  * params {string} orderId 订单id
  * @return 
  */
function getPreOrderById(orderId){
	return request({
		url:`/lejuClient/order/getPreOrderById/${orderId}`,
	})
}
/** 
  * 获取全部地址
  * @return 
  */
function findAllAddress(){
	return request({
		url:`/lejuClient/address/findAllAddress`,
	})
}
/** 
  * 更改收货地址
  * @return 
  */
function updateAddressInfo(data){
	return request({
		url:`/lejuClient/address/updateAddressInfo`,
		method:'post',
		data
	})
}
/** 
  * 添加收货地址
  * @return 
  */
function addAddressInfo(data){
	return request({
		url:`/lejuClient/address/addAddressInfo`,
		method:'post',
		data
	})
}
/** 
  * 删除收货地址
  * @return 
  */
function delAddressInfo(id){
	return request({
		url:`/lejuClient/address/delAddressInfo/${id}`,
		method:'delete'
	})
}
	
/** 
  * 确认订单
  * @return 
  */
function addConfirmOrder(data){
	return request({
		url:`/lejuClient/order/addConfirmOrder`,
		method:'post',
		data
	})
}
	
/** 
  * 修改地址的默认状态
  * @return 
  */
function switchDefault(addressId,defaultStatus){
	return request({
		url:`/lejuClient/address/switchDefault/${addressId}/${defaultStatus}`,
		method:'post'

	})
}
	
/** 
  * 确认付款
  * @return 
  */
function payConfirm(data){
	return request({
		url:`/lejuClient/order/payConfirm`,
		method:'post',
		data

	})
}
/** 
  * 删除购物车商品
  * @return 
  */
function delCartItems(data){
	return request({
		url:`/lejuClient/cart/delCartItems`,
		method:'post',
		data

	})
}
/** 
  * 获取所有订单
  * @return 
  */
function findAllOrders(){
	return request({
		url:`/lejuClient/order/findAllOrders`

	})
}
/** 
  * 根据订单ID取消订单
  * params {String} orderId 订单编号
  * @return 
  */
function cancelOrder(orderId){
	return request({
		url:`/lejuClient/order/cancelOrder/${orderId}`,
		method:'post'

	})
}
/** 
  * 退单
  * @return 
  */
function addOrderReturnApply(data){
	return request({
		url:`/lejuClient/orderReturn/addOrderReturnApply`,
		method:'post',
		data

	})
}
/** 
  * 获取退单地址
  * @return 
  */
function getCompanyAddrss(){
	return request({
		url:`/lejuClient/orderReturn/getCompanyAddrss`

	})
}
	
/** 
  * 查看退单订单列表
  * @return 
  */
function orderReturnApplys(){
	return request({
		url:`/lejuClient/orderReturn/orderReturnApplys`

	})
}
/** 
  * 强制删除单个订单
  * @return 
  */
function _clearOrderFocus(orderId){
	return request({
		url:`/lejuClient/order/_clearOrderFocus?orderId=${orderId}`,
		method:'post'

	})
}
/** 
  * 确认收货
  * @return 
  */
function receiveDone(data){
	return request({
		url:`/lejuClient/order/receiveDone`,
		method:'post',
		data

	})
}
	
export {
	productDetail,addCart,switchDefault,payConfirm,delCartItems,findAllOrders,cancelOrder,addOrderReturnApply,getCompanyAddrss,orderReturnApplys,_clearOrderFocus,receiveDone,
	addConfirmOrder,addPreOrder,getPreOrderById,findAllAddress,updateAddressInfo,addAddressInfo,delAddressInfo
}